<template>
  <div>
    <div class="content-wrapper f0">
    <div class="pad">
      <img class="avater" src="./logo.jpg">
      <div class="content">
        <img class="ico" src="./pp.png">
        <span class="title">{{seller.name}}</span>
        <div class="descript">{{seller.description}}/{{seller.deliveryTime}}分钟送达</div>
        <div v-if="seller.supports" class="support flex middle">
          <span class="icon" :class="classMap[seller.supports[0].type]"></span>
          <span class="text">{{seller.supports[0].description}}</span>
        </div>
      </div>
      </div>
      <div v-if="seller.supports" class="support-count">
        <div class="count" @click="showDetail">{{seller.supports.length}}个<i class="iconfont icon-more arrow"></i></div>
      </div>
      <div class="tip flex" @click="showDetail">
        <div class="tip-name m ">公告</div>
        <div class=" overhide cell-main tip-detail ">{{seller.bulletin}}</div>
        <i class="iconfont icon-more arrow"></i>
      </div>
      <div class="background"></div>
      <div class="detail" v-show="detailShow" transition="fade">
        <div class="detail-weapper clearfix">
          <div class="detail-main">
            <h1 class="name">{{seller.name}}</h1>
            <div class="star-wrapper">
              <star :size="48" :score="seller.score"></star>
            </div>
            <div class="title flex">
              <div class="line cell-main"></div>
              <div class="text">优惠信息</div>
              <div class="line cell-main"></div>
            </div>
            <ul class="supports" v-if="seller.supports">
              <li class="item" v-for="(item,index) in seller.supports">
                <span class="icon" :class="classMap[seller.supports[index].type]"></span>
                <span class="text">{{seller.supports[index].description}}</span>
              </li>
            </ul>
            <div class="title flex">
              <div class="line cell-main"></div>
              <div class="text">商家公告</div>
              <div class="line cell-main"></div>
            </div>
            <div class="bulletion">
              <p class="content">{{seller.bulletin}}</p>
            </div>
          </div>
        </div>
        <div class="detail-close" @click="hideDetail">
          <span class="icon-close" >&times;</span>
        </div>
      </div>
    </div>
  </div>
</template>
<script type="ecmascript-6">
  import star from '../star/star.vue';


  export default{
    props:{
      seller:{
        type:Object
      }
    },
   name:'', 
  data(){ return{
    detailShow:false,
    classMap:['decrease', 'discount', 'special', 'invoice', 'guarantee'],
   }}, 
   methods:{
    showDetail(){
      this.detailShow=true;
    },
    hideDetail(){
      this.detailShow=false;
    }
   },
  components:{star}, 
  }
</script>
<style rel="stylesheet" lang="less">
html {
  font-size: 20px;
}

.content-wrapper {

  position: relative;
  color: #fff;
  .pad{
      box-sizing: border-box;
  padding: 24px 12px;
  }
  .tip-detail{
    font-size: 12px;
    margin: 0 0.3rem;
  }
  .tip-name{
    background-color: #fff;
    color: #555;
    font-weight: bold;
  }
  .tip{
    background-color: rgba(0, 0, 0, 0.2);
    padding: 0.2rem 0.3rem;
    line-height: 1.05rem;
  }
  .avater {
    display: inline-block;
    height: 2.5rem;
    width: 2.5rem;
  }
  .content {
    display: inline-block;
    margin-left: 0.8rem;
  }
  .brand {
    width: 1.5rem;
    height: 0.9rem;
  }
  .ico {
    display: inline-block;
    width: 1.5rem;
    height: 0.9rem;
  }
  .title {
    margin-left: 0.3rem;
    font-size: 16px;
    line-height: 18px;
    font-weight: bold;
  }
  .support {
    line-height: 18px;
  }
  .descript {
    margin: 0.3rem 0;
    line-height: 12px;
    font-size: 14px;
  }
  .icon {
    display: inline-block;
    width: 0.8rem;
    height: 0.8rem;
    margin-right: 0.2rem;
  }
  .text {
    font-size: 10px;
  }
  .support-count {
    position: absolute;
    right: 0.6rem;
    bottom: 1.8rem;
    padding: 0 0.4rem;
    line-height: 1.2rem;
    border-radius: 0.6rem;
    background-color: rgba(0, 0, 0, 0.3);
  }
  .count {
    font-size: 10px;
  }
  .arrow {
    color: #fff;
    font-size: 14px;
  }
}
.decrease{
  background: url('./reduce.png');background-size: 100% 100%;
}
.discount{
  background: url('./discount.png');background-size: 100% 100%; 
}
.special{
 background: url('./special.png');background-size: 100% 100%;  
}
.invoice{
  background: url('./piao.png');background-size: 100% 100%;  
}
.guarantee{
   background: url('./promise.png');background-size: 100% 100%;  
}
.background{
  position: absolute;
  top: 0;
  left: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  background: url('./header.png');background-size: 100% 100%;
}
.content-wrapper .detail{
position: fixed;
top: 0;
left: 0;
z-index: 4;
    opacity: 1;
    background: rgba(7,17,27,0.8);
width: 100%;
height: 100%;
overflow: hidden;
transition: all 0.5s;
}
.content-wrapper .detail-weapper {
width: 100%;
min-height: 100%;
overflow: hidden;
}
.content-wrapper .detail-main{
  margin: 3.2rem auto;
  .name{
    font-size: 16px;
    line-height: 0.8rem;
    text-align: center;
    font-weight: 700;
  }
  .title{
    width: 80%;
    margin: 1.3rem auto;
  }
  .line{
    position: relative;
    top: -0.4rem;
    border-bottom: 1px solid rgba(255,255,255,0.5);
  }
  .text{
    padding: 0 12px;
    font-weight: 700;
    font-size: 16px;
  }
  .supports{
    width: 80%;
    margin: 0 auto;
    .item{
      padding: 0 0.6rem;
      margin-bottom: 0.6rem;
      font-size: 0;
    }
    .icon{
      display: inline-block;
      width: 0.8rem;
      height: 0.8rem;
      vertical-align: top;
      margin-right: 0.3rem;
      background-size: 0.8rem 0.8rem;
      background-repeat: no-repeat;
    }
    .text{
      font-size: 14px;
    }
  }
  .bulletion{
    width: 80%;
    margin: 0 auto;
    height: auto;
    .content{
      padding: 0 0.6rem;
      line-height: 1.2rem;
      font-size: 12px;
    }
  }
}
.content-wrapper{
  .detail-close{
    position: relative;
    width: 1.6rem;
    height: 1.6rem;
    margin: -3.05rem auto 0;
    clear: both;
    font-size: 1.6rem;
  }
}
</style>
